package com.bwie.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: day0513-week3
 * @ClassName MyRabbit
 * @description:
 * @author: 段阳
 * @create: 2024-05-13 11:06
 **/
@Configuration
public class MyRabbit {

    @Bean
    public Queue msgQueue(){
        //true 表示开启信息持久化
        return new Queue("msgQueue",true);
    }
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }
    @Bean
    public Binding msgBind(){
        return BindingBuilder.bind(msgQueue()).to(directExchange()).with("msg");
    }
}